home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Toolbox / Menu Defproc 1.0.3 / Concordia.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-06  |  3.3 KB  |  98 lines  |  [TEXT/MPS ]

  1. /*============================================================================*\
  2. * Concordia.c - Entry point to the Concordia MDEF
  3. *
  4. * Corcordia.c contains the entry point to the concordia MDEF at the function
  5. * called main.  This file also contains two routines, GetTextState and
  6. * SetTextState, that didn't really seem to fit categorically in any other source
  7. * file (they should really have been in ROM, like Get- and SetPenState!).
  8. \*============================================================================*/
  9.  
  10.  
  11. /******************************************************************************\
  12. * Header Files
  13. \******************************************************************************/
  14.  
  15. #include <Menus.h>
  16. #include <Quickdraw.h>
  17. #include <Types.h>
  18. #include "ChooseTkl.h"
  19. #include "Concordia.h"
  20. #include "DrawTkl.h"
  21. #include "PopUpTkl.h"
  22. #include "SizeTkl.h"
  23.  
  24.  
  25. /******************************************************************************\
  26. * Function Prototypes
  27. \******************************************************************************/
  28.  
  29. pascal void main (short, MenuHandle, Rect *, Point, short *);
  30.  
  31.  
  32. #pragma segment Main
  33. /******************************************************************************\
  34. * main - Entry point for the Concordia MDEF
  35. \******************************************************************************/
  36.  
  37. pascal void
  38. main (Message, TheMenu, MenuRect, HitPt, WhichItem)
  39.     short      Message;    //Operation to be performed >>
  40.     MenuHandle TheMenu;    //=> Affected menu <>
  41.     Rect       *MenuRect;  //-> Menu's rectangle <>
  42.     Point      HitPt;      //Position of mouse >>
  43.     short      *WhichItem; //Selected item number <>
  44.     {
  45.     if (Message == mDrawMsg)
  46.         DoDrawMsg (TheMenu, MenuRect);
  47.     else if (Message == mChooseMsg)
  48.         *WhichItem = DoChooseMsg (TheMenu, MenuRect, HitPt, *WhichItem);
  49.     else if (Message == mSizeMsg)
  50.         DoSizeMsg (TheMenu);
  51.     else if (Message == mPopUpMsg)
  52.         *WhichItem = DoPopUpMsg (TheMenu, MenuRect, HitPt.h, HitPt.v,
  53.                 *WhichItem);
  54.     }
  55.  
  56.  
  57. #pragma segment Main
  58. /******************************************************************************\
  59. * GetTextState - Get the current state of text
  60. *
  61. * GetTextState gets the typeface, typestyle, typesize, and drawing mode of the
  62. * current font of the current GrafPort and places this information in the
  63. * TextStateRec specified by TextInfo.
  64. \******************************************************************************/
  65.  
  66. void
  67. GetTextState (TextInfo)
  68.     TextStateRec *TextInfo; //-> Text state info <<
  69.     {
  70.     GrafPtr CurrPort; //-> Current graphics port
  71.  
  72.     GetPort (&CurrPort);
  73.     TextInfo->txFace = CurrPort->txFont;
  74.     TextInfo->txStyle = CurrPort->txFace;
  75.     TextInfo->txMode = CurrPort->txMode;
  76.     TextInfo->txSize = CurrPort->txSize;
  77.     }
  78.  
  79.  
  80. #pragma segment Main
  81. /******************************************************************************\
  82. * SetTextState - Set the current state of text
  83. *
  84. * SetTextState gets the typeface, typestyle, typesize, and drawing mode of the
  85. * current font of the current GrafPort and places this information in the
  86. * TextStateRec specified by TextInfo.
  87. \******************************************************************************/
  88.  
  89. void
  90. SetTextState (TextInfo)
  91.     TextStateRec *TextInfo; //-> Text state info >>
  92.     {
  93.     TextFont (TextInfo->txFace);
  94.     TextFace (TextInfo->txStyle);
  95.     TextMode (TextInfo->txMode);
  96.     TextSize (TextInfo->txSize);
  97.     }
  98.